package test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Demo {
	
	public static void main(String[] args) {
		List<User> ulist = new ArrayList<>();
		User u1 = new User(1l, "zhangsan", "123");
		ulist.add(u1);
		User u2 = new User(2l, "lisi", "124");
		ulist.add(u2);
		User u3 = new User(3l, "wangwu", "125");
		ulist.add(u3);
		
		Map<String, User> map = new HashMap<>();
		for (User user : ulist) {
			map.put(user.getId()+"", user);
			user.setDept("abc");
		}
		
		for (String s : map.keySet()) {
			System.out.println("key : " + s + " value : " + map.get(s).toString());
		}
	}

}
